package vn.bang.entity;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

@Entity
@Table(name = "user")
public class UserDTO implements Serializable {
	
	private static final long serialVersionUID = 1L;

	@Id
	@Column(name = "id", nullable = false)
	private Long id;
	@ManyToOne(fetch = FetchType.EAGER, cascade = CascadeType.MERGE)
	@JoinColumn(name = "role_id")
	private RoleDTO role;
	@ManyToOne(fetch = FetchType.EAGER, cascade = CascadeType.MERGE)
	@JoinColumn(name = "player_id")
	private PlayerDTO player;
	@Column(name = "username")
	private String username;
	@Column(name = "password")
	private String password;
	@Column(name = "last_login_time")
//	@Temporal(TemporalType.DATE)
	private Date lastLoginTime;
	@Column(name = "active")
	private boolean active;
	
	public Long getId() {
		return id;
	}
	public RoleDTO getRole() {
		return role;
	}
	public PlayerDTO getPlayer() {
		return player;
	}
	public String getUsername() {
		return username;
	}
	public String getPassword() {
		return password;
	}
	public Date getLastLoginTime() {
		return lastLoginTime;
	}
	public boolean isActive() {
		return active;
	}
	public void setId(Long id) {
		this.id = id;
	}
	public void setRole(RoleDTO role) {
		this.role = role;
	}
	public void setPlayer(PlayerDTO player) {
		this.player = player;
	}
	public void setUsername(String username) {
		this.username = username;
	}
	public void setPassword(String password) {
		this.password = password;
	}
	public void setLastLoginTime(java.util.Date lastLoginTime) {
		this.lastLoginTime = lastLoginTime;
	}
	public void setActive(boolean active) {
		this.active = active;
	}
	
}
